package com.czk.gulimall.product.feign;

import com.czk.common.to.SkuReduction;
import com.czk.common.to.SpuBoundTo;
import com.czk.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/12/22 15:10
 */
@FeignClient(value = "gulimall-coupon")
public interface CouponFeignService {
    /**
     * 保存积分
     * springcloud feign调用逻辑
     * 1 将传输的对象转为json->requestBody注解
     * 2 找到远程服务，给服务的controller发送请求，将上异步转的json放在请求体位置发送请求
     * 3 接收到请求的服务将json数据重新转换为需要的实体类，只要json的数据模型是兼容的，双方服务无需使用同一实体类
     *
     * @param spuBoundTo
     */
    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);
    @PostMapping("/coupon/skufullreduction/saveinfo")
    R saveSkuReduction(@RequestBody SkuReduction skuReduction);
}
